<?php
use Think\Controller;

Class AdminController extends BaseController
{
    public function _initialize()
    {
        parent::_initialize();
        if (!session('admin_user_name')) {
            $this->jump("", AdminUrl . "/Login/index");
            exit();
        }
        C('VIEW_PATH', C('VIEW_PATH_ADMIN') ? C('VIEW_PATH_ADMIN') : C('VIEW_PATH'));
        $this->user_name = session('user_name');
        $this->isSuper = session('isSuper');
        $this->admin_user_info = BoxModel("system_store_user")->where(array('id'=>session('admin_id')))->find();
								//dump(array('id'=>session('admin_id')));
        $this->store_id = $this->admin_user_info['store_id'] ? $this->admin_user_info['store_id'] : 1;
        $this->admin_store_info = BoxModel("SystemStore")->load($this->store_id);
        session('admin_user_info', $this->admin_user_info);
        session('admin_store_info', $this->admin_store_info);
        /*如果是管理员权限认证*/
        $this->auth_check();
    }

    /**
     * 权限认证
     */
    protected function auth_check()
    {
        hook("Auth/Check/index");    //权限控制
    }

    /***display**/
    public function display($tpl)
    {
        $show_content = parent::fetch($tpl);
        $this->admin_display($show_content);
    }


}